#ifndef SC_TEST_H
#define SC_TEST_H

#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "sc_core.h"
#ifdef _TEST
#include <d3dx9.h>
BEGIN_K3D
#define  FLOAT_ACCURACY 0.1f
inline bool KEqualf(float a,float b)
{
	float c=a-b;
	return c<=FLOAT_ACCURACY&&c>=-FLOAT_ACCURACY;
}
inline bool KEqual(Vector3& v1,D3DXVECTOR3& v2)
{
	return KEqualf(v1._x,v2.x)&&KEqualf(v1._y,v2.y)&&KEqualf(v1._z,v2.z); 
}
inline bool KEqual(Vector& v1,D3DXVECTOR4& v2)
{
	return KEqualf(v1.x,v2.x)&&KEqualf(v1.y,v2.y)&&KEqualf(v1.z,v2.z)&&KEqualf(v1.w,v2.w);
}
inline bool KEqual(Matrix& m,D3DXMATRIX& dm)
{
	return KEqualf(m._11,dm._11)&&KEqualf(m._12,dm._21)&&KEqualf(m._13,dm._31)&&KEqualf(m._14,dm._41)&&
		KEqualf(m._21,dm._12)&&KEqualf(m._22,dm._22)&&KEqualf(m._23,dm._32)&&KEqualf(m._24,dm._42)&&
		KEqualf(m._31,dm._13)&&KEqualf(m._32,dm._23)&&KEqualf(m._33,dm._33)&&KEqualf(m._34,dm._43)&&
		KEqualf(m._41,dm._14)&&KEqualf(m._42,dm._24)&&KEqualf(m._43,dm._34)&&KEqualf(m._44,dm._44);
}
// inline bool KEqual(vector3& v1,D3DXVECTOR3 v2);
// inline bool KEqual(vector3& v1,D3DXVECTOR3 v2);
// inline bool KEqual(vector3& v1,D3DXVECTOR3 v2);
// inline bool KEqual(vector3& v1,D3DXVECTOR3 v2);


inline float randomFloat()
{
	return rand()/100.0f;
}
inline void randomSet(Matrix&  m,D3DXMATRIX& dm)
{
	m._11=dm._11=randomFloat();
	m._12=dm._21=randomFloat();
	m._13=dm._31=randomFloat();
	m._14=dm._41=randomFloat();

	m._21=dm._12=randomFloat();
	m._22=dm._22=randomFloat();
	m._23=dm._32=randomFloat();
	m._24=dm._42=randomFloat();

	m._31=dm._13=randomFloat();
	m._32=dm._23=randomFloat();
	m._33=dm._33=randomFloat();
	m._34=dm._43=randomFloat();

	m._41=dm._14=randomFloat();
	m._42=dm._24=randomFloat();
	m._43=dm._34=randomFloat();
	m._44=dm._44=randomFloat();
}
inline void randomSet(Vector3& v,D3DXVECTOR3& dv)
{
	v._x=dv.x=rand()/100.0f;
	v._y=dv.y=rand()/100.0f;
	v._z=dv.z=rand()/100.0f;
}
inline void randomSet(Vector& v,D3DXVECTOR4& dv)
{
	v.x=dv.x=rand()/100.0f;
	v.y=dv.y=rand()/100.0f;
	v.z=dv.z=rand()/100.0f;
	v.w=dv.w=rand()/100.0f;
}





END_K3D

#endif
#endif


 

